[BLKTAP] Fix blktap oops on domain shutdown
authorAndrew Warfield <andy@xensource.com>
Thu, 28 Sep 2006 18:41:23 +0000 (11:41 -0700)
committerAndrew Warfield <andy@xensource.com>
Thu, 28 Sep 2006 18:41:23 +0000 (11:41 -0700)
commitd9b9f4d2243393944d375009fdf8fb07aa459180
tree9744d6f18fa9b6ece3aed48568e7f305dfaa96e8
parent5d0d32609ebacfb93555e04deeea4a057140c2a2
[BLKTAP] Fix blktap oops on domain shutdown
When a domain shuts down with a blktap-backed block device open, it can
easily cause a dom0 oops.  The XenbusStateClosing event can occur while
the tapdisk userland thread is still processing IO requests (eg.
readaheads) from the domU.  But the xenbus state handler calls
tap_blkif_unmap(), unmapping the blkif->blk_ring.sring rin buffer, so
when the tapdisk thread next calls the BLKTAP_IOCTL_KICK_FE to return
the completion event to the FE via that ring buffer, it oopses.

This can be fixed simply by not calling tap_blkif_unmap() in this case;
the ring buffer will still be unmapped later on when the blkif is
destroyed by blktap_remove(), only then it will properly wait for the
blkif refcnt to reach zero before doing so.

Signed-off-by: Stephen Tweedie <sct@redhat.com>
linux-2.6-xen-sparse/drivers/xen/blktap/xenbus.c